repo: Make ostree_repo_create() nonfatal on existing repos
authorColin Walters <walters@verbum.org>
Mon, 1 Aug 2016 14:43:49 +0000 (10:43 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 1 Aug 2016 15:12:14 +0000 (15:12 +0000)
commit5334758ba7309438686c779e4ff943a5f84b6868
tree82c0256f23a129f67da46017f8144f7602c0a66d
parenta312d8fd8c3d6b57e17354ae6b14227729c45ab3
repo: Make ostree_repo_create() nonfatal on existing repos

In general we want to support "idempotentcy" or "state
synchronization" across interruption.  If a repo is only partially
created due to a crash or whatever, it's hard for a user to know that.
Let's just make `ostree_repo_create()` idempotent. Since all we're
doing is a set of `mkdirat()` invocations, it's quite simple.

This also involved porting to fd-relative, which IMO makes the
code a lot clearer.

Closes: #422
Approved by: 14rcole
src/libostree/ostree-repo.c
tests/basic-test.sh